    <template>
  <div class="login-container">
    <!-- ref 相当于 id，:model 表单数据对象, label-width 表单域标签的的宽度 -->
    <el-form ref="form" :model="form" :rules="rules" label-width="80px" class="login-form">
      <h2 class="login-title">大逼神管理系统</h2>
      <el-form-item label="帐号" prop="phone">
        <el-input v-model="form.phone" placeholder="请输入帐号"></el-input>
      </el-form-item>
      <el-form-item label="密码" prop="password">
        <el-input type="password" v-model="form.password" placeholder="请输入密码"></el-input>
      </el-form-item>
      <el-form-item>
        <el-button type="primary" @click="onSubmit">登录</el-button>
      </el-form-item>
    </el-form>
  </div>
</template>
<script>
	import { mapState, mapMutations } from "vuex";
export default {
  data() {
    return {
      form: {
				phone:'',
				password:''
			},
      rules: {
        //表单验证
        phone: [
          { required: true, message: "请输入有效帐号", trigger: "blur" }
        ],
        password: [
          { required: true, message: "请输入有效密码", trigger: "blur" }
        ]
      }
    };
  },
  methods: {
    // 注意：按钮上调用的函数名要一致 submitForm
    onSubmit(formName) {
      this.$refs.form.validate(valid => {
        if (valid) {
			this.postAxios("login/login_in",this.form).then(resp=>{
				if(resp.code==200){
					this.$message.success(resp.message);
					console.log(resp.data.token)
					localStorage.setItem('Authorization',resp.data.token);
					localStorage.setItem('SYSTEM_USER',JSON.stringify(resp.data.sysUser));
					localStorage.setItem("MENU_LIST",JSON.stringify(resp.data.menus));
					localStorage.setItem("POINT_LIST",JSON.stringify(resp.data.points));
					this.$router.push("/")
				}else{
					this.$message.error(resp.message);
				}
			})
        } else {
          this.$message.success("用户名密码不能为空");
          return false;
        }
      });
    }
  }
};
</script>
<style scoped>
.login-form {
  width: 350px;
  /* 上下间隙150px, 左右自动 */
  margin: 160px auto;
  /*透明背景色*/
  background-color: rgb(255, 255, 255, 0.8);
  padding: 30px;
  /* 圆角 */
  border-radius: 20px;
}
.login-container {
  position: absolute;
  width: 100%;
  height: 100%;
  background: url("../../assets/login.jpg");
  overflow: hidden;
}
/* 标题 */
.login-title {
  text-align: center;
  color: #303133;
}
</style>